package demo3;

//逆置字符串
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        char[] s = str.toCharArray();
        int n  = str.length();
        reverse(s,0,n-1);
        int i = 0;
        while(i<n) {
            int j = i;
            while(j<n && s[j]!=' ') {
                j++;
            }
            reverse(s, i, j-1);
            i = j+1;
        }

        System.out.println(new String(s));
    }
    
    public static void reverse(char[] s, int l, int r) {
        while(l<r) {
            char t = s[l];
            s[l] = s[r];
            s[r] = t;
            l++;
            r--;
        }
    }
}